---
title: "Right-wing terror, media backlash, and voting preferences for the far right<br><br>Replication archive<br><br>"
author: "Alexander De Juan, Felix Haass, Julian Voss"
date: '2025-05-01'
format: 
  html:
    embed-resources: true
    self-contained-math: true
    keep-md: false
    theme: cosmo
    highlight: tango
    toc: true
    toc_float:
      collapsed: false
      smooth_scroll: true

---

# Download

To replicate the tables and figures in the main text and in the appendix make sure that you download the entire replication archive from the Dataverse and unzip it into one folder. 


# Folder structure

- `./code/`: Contains all the scripts necessary to replicate figures and tables in the paper and appendix. 
- `./data/`: Contains all the data files necessary for the scripts in `./code/` to run
- `./figures/`: All the plots produced by the scripts in `./code/` will be saved here.
- `./tables/`: All the tables produced by the scripts in `./code/` will be saved here.

In addition, the archive folder contains the following files:

- `README.qmd` & `README.html`: This HTML file and the Quarto/markdown script to generate this HTML file.
- `replication_archive.rproj`: The R project file to run the scripts.


# Replication

## R scripts

To replicate figures and tables generated in R, follow these steps:

1. **Important:** Open the file `replication_archive.rproj` in RStudio first. This step is necessary to set all the correct file paths in the other R scripts. 
2. From within RStudio, open the R script in the `/code/` folder for which you want to replicate the results. Script names indicate whether figures from the paper or the appendix are supposed to be generated. 
3. Run the script. If you run the entire script, all necessary data files will be loaded automatically from the `/data/` folder. If you wish to reproduce only select figures/tables, make sure to run everything up the covariates section first, so that all the necessary data files are loaded and covariate vectors are defined. 
4. Results will be stored in `/figures/` or `/tables/` with the table/figure name corresponding to its name in the final manuscript/Appendix. 


# Software versions and packages

## R version & packages

The following packages are required to run the R scripts. You can copy and paste the commands below in your R console to automatically install or update them. 


```{r, eval=FALSE}

install.packages("tidyverse")
install.packages("ggrepel")
install.packages("patchwork")
install.packages("fixest")
install.packages("broom")
install.packages("haven")
install.packages("ggtext")
install.packages("fastDummies")
install.packages("marginaleffects")
install.packages("modelsummary")
install.packages("tinytable")
install.packages("sjlabelled") 


```

We use the following R software and package versions:

```{r, echo=FALSE, message=FALSE, warning=FALSE}
# 
library(tidyverse)
library(ggrepel)
library(patchwork)
library(fixest)
library(broom)
library(haven)
library(ggtext)
library(fastDummies)
library(marginaleffects)
library(modelsummary)
library(tinytable)
library(sjlabelled)

sessionInfo()
```

